package top.appx.tag;


import top.appx.util.DateTimeUtil;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;

/**
 * Created by john on 2015/8/1.
 */
public class DateTimeFormatTag extends SimpleTagSupport {
    private Timestamp time;
    private String format;

    public DateTimeFormatTag(){
        this.format = "yyyy-MM-dd HH:mm:ss";
    }
    @Override
    public void doTag() throws JspException, IOException {
        this.getJspContext().getOut().print(new SimpleDateFormat(format).format(time));
    }
    public void setTime(Timestamp time) {
        this.time = time;
    }
    public void setFormat(String format){this.format = format;}
}
